<template>
	<view>
		<nav-custom :name="title"></nav-custom>
		<view class="list" v-if="info">
			<view class="list_a">
				<image class="a_img" :src="url+'/image/qbback.png'" mode=""></image>
				<view class="list_a_a">
					<view class="a_a_left dis_f_sb_c">
						<view>
							<view class="white_f_28 bor_b_16">我的资产(元)</view>
							<view class="white_f_52">{{info.my_assets}}</view>
						</view>
						<image class="jf_img" :src="url+'/image/jficon.png'" mode=""></image>
					</view>
					<view class="dis_f_l_c white_f_28">
						<view class="a_text">可提现 ￥{{info.withdrawable}}</view>
						<view class="a_text">已提现 ￥{{info.withdrawns}}</view>
					</view>
				</view>
			</view>
			<view class="black_f_32 bor_bot">资金记录</view>
			<view>
				<!-- <scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" @scroll="scroll">
					<view class="back dis_f_sb_c bor_bot">
						<view class="dis_f_l_c">
							<image class="y_img" :src="url+'/logo.png'" mode=""></image>
							<view>
								<view class="black_f_28">20225113215554</view>
								<view class="grey_s_24">2022-05-12 20:30</view>
							</view>
						</view>
						<view class="blue_f_36">+180.05</view>
					</view>
					<view class="back dis_f_sb_c bor_bot">
						<view class="dis_f_l_c">
							<image class="y_img" :src="url+'/logo.png'" mode=""></image>
							<view>
								<view class="black_f_28">提现</view>
								<view class="grey_s_24">2022-05-12 20:30</view>
							</view>
						</view>
						<view class="orange_f_36">-10180.05</view>
					</view>
				</scroll-view> -->
				
				<view class="scroll-Y">
					<view class="back dis_f_sb_c bor_bot" v-for="(item,index) in lists">
						<view class="dis_f_l_c">
							<image class="y_img" :src="item.image" mode=""></image>
							<view>
								<view class="black_f_28">{{item.order}}</view>
								<view class="grey_s_24">{{item.createtime}}</view>
							</view>
						</view>
						<view class="blue_f_36" v-if="item.type_text == '+'">{{item.type_text}}{{item.money}}</view>
						<view class="orange_f_36" v-else>{{item.type_text}}{{item.money}}</view>
					</view>
				</view>
			</view>
			<!-- <u-loadmore :status="status" color="#a3a0a0" /> -->
		</view>
		<view class="bule_back_but white_f_32 bot_wz" @click="deposit()">
			提现
		</view>
		<view style="background-color: #fff;">
		  <image class="bo_js_img" :src="url+'/image/zcxian.png'" mode=""></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "我的钱包",
				scrollTop: 0,
				old: {
					scrollTop: 0
				},
				info:[],
				lists:[],
				page:1,
				total:0,
				count:0,
				status: 'loadmore',
				url:'',
			}
		},
		onShow() {
			this.url=this.$.ajax_url3
			this.get_info()
			this.page = 1;
			this.get_lists()
		},
		onReachBottom() {
			// if (this.page >= this.total){
			// 	 this.status = 'nomore';
			// 	  return;
			// }
			this.status = 'loading';
			this.page++
			this.get_lists()
		},
		onPullDownRefresh(){
			this.status = 'loading';
			this.page = 1;
			this.lists = [];
			this.get_lists()
		},
		methods: {
			get_info(){
				this.$.ajax(1,'post','store/store/my_wallet',{},(res)=>{
					if(res.code == 200){
						this.info = res.data
					}else{
						this.$.ti_shi(res.msg)
					}
				});
			},
			get_lists(){
				this.$.ajax(1,'post','store/store/financialrecords_list',{
					page:this.page,
					pagesize:10,
				},(res)=>{
					// this.total = res.data.total
					// this.count = res.data.count
					if(this.page == 1){
						this.lists = res.data
					}else{
						this.lists = this.lists.concat(res.data)
					}
					// if (this.page >= this.total){
					// 	this.status = 'nomore';
					// }else{
					// 	this.status = 'loadmore';
					// }
				})
			},
			scroll: function(e) {
				console.log(e)
				this.old.scrollTop = e.detail.scrollTop
			},
			goTop: function(e) {
				// 解决view层不同步的问题
				this.scrollTop = this.old.scrollTop
				this.$nextTick(function() {
					this.scrollTop = 0
				});
				uni.showToast({
					icon: "none",
					title: "纵向滚动 scrollTop 值已被修改为 0"
				})
			},
			deposit(){
				uni.navigateTo({
					url:'/pages-2/wd_er/zj_tx'
				})
			}
		}
	}
</script>

<style lang="scss">
	.list_a {
		width: 686rpx;
		height: 320rpx;
		position: relative;
		margin-bottom: 40rpx;

		.a_img {
			width: 686rpx;
			height: 320rpx;
			position: absolute;
			top: 0;
			left: 0;
		}

		.list_a_a {
			position: absolute;
			top: 40rpx;
			left: 40rpx;

			.a_a_left {
				width: 590rpx;
			}

			.jf_img {
				width: 144rpx;
				height: 144rpx;
			}
		}
		.a_text {
			margin-top: 48rpx;
			margin-right: 48rpx;
		}
	}

	.scroll-Y {
		height: 49vh;

		.y_img {
			width: 96rpx;
			height: 96rpx;
			margin-right: 10rpx;
			border-radius: 16rpx;
		}
	}
</style>